package com.zzz.message.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import com.aliyun.teaopenapi.models.Config;
import com.aliyun.dysmsapi20170525.Client;

/**
 * @BelongsProject: oj-project
 * @BelongsPackage: com.zzz.message.config
 * @Author: zhai
 * @CreateTime: 2025-10-25  19:51
 * @Description: TODO 阿里云短信服务配置
 * @Version: 1.0
 */
@Configuration
public class AliSmsConfig {

    @Value("${aliyun.sms.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.sms.accessKeySecret}")
    private String accessKeySecret;
    @Value("${sms.aliyun.endpoint:}")
    private String endpoint;

    public Client createClient() throws Exception {
        Config config = new Config()
                .setAccessKeyId(accessKeyId)
                .setAccessKeySecret(accessKeySecret);
        config.endpoint = endpoint;
        return new Client(config);
    }
}
